package com.qiahao.mapper;

import com.qiahao.bean.Phone;
import com.qiahao.bean.Question;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface QuestionMapper {

    @Insert("insert into question_info(question,path,createtime,error_answer,correct_answer,title,other_answer) values (#{question},#{path},now(),#{errorAnswer},#{correctAnswer},#{title},#{otherAnswer} )")
    void AddQuestion(Question question);


    @Select("select * from question_info order by createtime desc")
    List<Question> getAllQuestion();

    @Select("select * from question_info a where a.question = #{question}")
    Question findPhoneByQuestionName(String question);

    @Select("select * from question_info a where a.id = #{questionId}")
    Question findPhoneByQuestionId(Long questionId);

    @Update("update question_info a set a.path=#{path} where a.id = #{id}")
    void updateQuestionPath(@Param("path") String path,@Param("id") Long id);
}
